// pages/sort_suning/sort_suning.js
// 引入当前模块化的JS文件 里面的抛出的方法
import {request} from "../../utils/https"
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 获取设备标题栏的高度（解决iPhone X这种刘海屏的影响）
    topWhiteHeight: wx.getMenuButtonBoundingClientRect()["bottom"],
    //标题选中样式
    active: 'active',
    selected: 'selected',
    leftList:[],
    floorIndex:0,
    rightRight:[]
  },
  clickFloor(e){
    console.log(e.currentTarget.dataset.floorindex)
    let _self = this;
    _self.data.floorIndex = e.currentTarget.dataset.floorindex;
    _self.data.rightRight = _self.data.leftList[_self.data.floorIndex].product_list;
    _self.setData({
      floorIndex:_self.data.floorIndex,
      rightRight:_self.data.rightRight
    })
  },
  onShow(){
    let _self = this;
    let data = {

    }
    request(
      "home/floordata",
      data,
      "GET",
      function(res){
        console.log(res)
       _self.data.leftList = res.data.message;
       _self.data.rightRight = res.data.message[_self.data.floorIndex].product_list;
        console.log(_self.data.rightRight)
       _self.setData({
        leftList:_self.data.leftList,
        rightRight:_self.data.rightRight
       })
      }
    )
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  }
})